/*
 * parser.hpp
 *
 *  Created on: 20.12.2010
 *      Author: Dmitry Bratus
 */

#ifndef RPARSER_HPP_
#define RPARSER_HPP_

#include <ruby.h>
#include <memory>
#include <sstream>
#include <stml.hpp>

static const size_t DEFAULT_BUFFER_CAPACITY_CHARS = 1024;

struct RBatchParserState {
    char* buffer;
    size_t len;
    size_t capacity;
    std::auto_ptr<std::stringstream> in;
    std::auto_ptr<std::stringstream> out;
    std::auto_ptr<stml::Parser> parser;
};

extern "C" {

void rbatch_parser_state_free(void* state);

VALUE rbatch_parser_class_new(VALUE klass);
VALUE rbatch_parser_initialize(VALUE self);
VALUE rbatch_parser_append_stml(VALUE self, VALUE stml_string);
VALUE rbatch_parser_generate(VALUE self, VALUE generator);

}

#endif /* PARSER_HPP_ */
